#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
typedef pair<double, double> PDD;

const int N = 2010;
PDD range[N];
int n;
double d;
bool cmp(PDD a, PDD b)
{
    return a.second < b.second;
}
int main()
{
    cin >> n >> d;
    bool flag = false;

    for (int i = 0; i < n; i++)
    {
        int x, y;
        cin >> x >> y;
        if (y > d)
        {
            flag = true;
            break;
        }
        double r = sqrt(d * d - y * y);
        range[i].first = x - r, range[i].second = x + r;
    }
    if (flag)
    {
        cout << "-1" << endl;
        return 0;
    }
    sort(range, range + n, cmp);

    int cnt = 0;

    for (int i = 0; i < n;)
    {
        cnt++;
        int j = i + 1;
        double r = range[i].second;
        while (r >= range[j].first && r <= range[j].second)
            j++;

        i = j;
    }

    cout << cnt << endl;

    return 0;
}